extern crate failure;
extern crate headless_chrome;

mod down;

use down::{down_html::browse_liv};

// use env_logger::Env;

use sixtyfps::{ VecModel, SharedString};

sixtyfps::include_modules!();

#[derive(Debug, std::clone::Clone)]
pub struct Text_ {
    text: SharedString,
}

// mod liv_fs;

// use liv_fs::{ dir };

fn main() {

    browse_liv();
    // let env = Env::default()
    // .filter_or("MY_LOG_LEVEL", "trace")
    // .write_style_or("MY_LOG_STYLE", "always");

    // env_logger::init_from_env(env);

    // trace!("some trace log");
    // debug!("some debug log");
    // info!("some information log");
    // warn!("some warning log");
    // error!("some error log");

    // if let Ok(()) = dir::new_dir() {
    //      println!("创建目录成功");
    // }

    let app = LivUpApp::new();
    app.on_quit(move |input| {
        println!("{:#?}", input);
        // if let Ok(()) = browse_liv() {
        //     println!("gh");
        // }
        // std::process::exit(0);
    });
    
    let slice = &[
        SharedString::from("asasasas"), 
        SharedString::from("jkhkkjkhjk"), 
        SharedString::from("ceshi"),
        SharedString::from("asasasas"), 
        SharedString::from("jkhkkjkhjk"), 
        SharedString::from("ceshi"),
        SharedString::from("asasasas"), 
        SharedString::from("jkhkkjkhjk"), 
        SharedString::from("ceshi"),
        SharedString::from("asasasas"), 
        SharedString::from("jkhkkjkhjk"), 
        SharedString::from("ceshi"),
        SharedString::from("asasasas"), 
        SharedString::from("jkhkkjkhjk"), 
        SharedString::from("ceshi"),
        SharedString::from("asasasas"), 
        SharedString::from("jkhkkjkhjk"), 
        SharedString::from("ceshi"),
        SharedString::from("asasasas"), 
        SharedString::from("jkhkkjkhjk"), 
        SharedString::from("ceshi"),
        SharedString::from("asasasas"), 
        SharedString::from("jkhkkjkhjk"), 
        SharedString::from("ceshi"),
        SharedString::from("asasasas"), 
        SharedString::from("jkhkkjkhjk"), 
        SharedString::from("ceshi"),
        SharedString::from("asasasas"), 
        SharedString::from("jkhkkjkhjk"), 
        SharedString::from("ceshi"),
        SharedString::from("asasasas"), 
        SharedString::from("jkhkkjkhjk"), 
        SharedString::from("ceshi"),
    ];

    let vec_model = VecModel::from_slice(slice);
    // println!("{:#?}", vec_model);
    // let data = Rc::new(vecModel);
    // let mh = ModelHandle::new(data);
    app.set_models(vec_model);
    app.run();
}
